import 'package:json_annotation/json_annotation.dart';

part 'doctor_list_res.g.dart';

@JsonSerializable(fieldRename: FieldRename.none)
class DoctorListRes {
  final int? code;
  final Data? data;
  final String? msg;

  const DoctorListRes({
    this.code,
    this.data,
    this.msg,
  });

  factory DoctorListRes.fromJson(Map<String, dynamic> json) =>
      _$DoctorListResFromJson(json);

  Map<String, dynamic> toJson() => _$DoctorListResToJson(this);

  DoctorListRes copyWith({
    int? code,
    Data? data,
    String? msg,
  }) {
    return DoctorListRes(
      code: code ?? this.code,
      data: data ?? this.data,
      msg: msg ?? this.msg,
    );
  }
}

@JsonSerializable(fieldRename: FieldRename.none)
class Data {
  final List<DoctorModel>? list;
  final int? total;

  const Data({
    this.list,
    this.total,
  });

  factory Data.fromJson(Map<String, dynamic> json) =>
      _$DataFromJson(json);

  Map<String, dynamic> toJson() => _$DataToJson(this);

  Data copyWith({
    List<DoctorModel>? list,
    int? total,
  }) {
    return Data(
      list: list ?? this.list,
      total: total ?? this.total,
    );
  }
}

@JsonSerializable(fieldRename: FieldRename.none)
class DoctorModel {
  final int? id;
  final int? userId;
  final int? deptId;
  final String? nickName;
  final String? dept;
  final String? title;
  final String? introduction;
  final String? licenseNumber;
  final int? createTime;
  final String? photo;
  final String? honor;

  const DoctorModel({
    this.id,
    this.nickName,
    this.dept,
    this.userId,
    this.deptId,
    this.title,
    this.introduction,
    this.licenseNumber,
    this.createTime,
    this.photo,
    this.honor,
  });

  factory DoctorModel.fromJson(Map<String, dynamic> json) =>
      _$DoctorModelFromJson(json);

  Map<String, dynamic> toJson() => _$DoctorModelToJson(this);

  DoctorModel copyWith({
    int? id,
    int? userId,
    int? deptId,
    String? title,
    String? nickName,
    String? dept,
    String? introduction,
    String? licenseNumber,
    int? createTime,
    String? photo,
    String? honor,
  }) {
    return DoctorModel(
      id: id ?? this.id,
      userId: userId ?? this.userId,
      deptId: deptId ?? this.deptId,
      nickName: nickName ?? this.nickName,
      dept: dept ?? this.dept,
      title: title ?? this.title,
      introduction: introduction ?? this.introduction,
      licenseNumber: licenseNumber ?? this.licenseNumber,
      createTime: createTime ?? this.createTime,
      photo: photo ?? this.photo,
      honor: honor ?? this.honor,
    );
  }
}
